﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace p2p.FileServer.Upload
{
    public partial class UploadServer: Control
    {
        public UploadServer()
        {
            InitializeComponent();
            // if were not created though the Visual Studios Designer we need to set the default values
            if (VSDesignerLoaded == null)
            {
                EnableUPNP = true;
                IPAddresses = new List<string>(){ "0.0.0.0" };
            }
        }

        // has the Visual Studios Designer Loaded this extension 
        // to check we will force the Visual Studios to set a property that the designer can't remove
        // this then allows the Visual Studios designer to set the properties but if there not we can
        // set the default values
        [System.ComponentModel.DefaultValue(true)]
        [System.ComponentModel.Browsable(false)]
        public bool VSDesignerLoaded
        {
            get;
            set;
        }

        // are we allowed to use UPNP on this machine
        [System.ComponentModel.DefaultValue(true)]
        public bool EnableUPNP
        {
            get;
            set;
        }

        // what IP Addresses are we binding to
        [System.ComponentModel.DefaultValue(new List<string>(){"0.0.0.0"})]
        public List<string> IPAddresses
        {
            get;
            set;
        }

        // add a P2P Task to the Upload Server so we can upload the files
        public void AddTasks(string hash, string filePath)
        {
        }

        // start uploading a task
        public void StartTask(string hash)
        {
        }

        // stop uploading a task 
        public void StopTask(string hash)
        {
        }

        // remove the P2P Task so that it can't be uploaded without being re-index
        public void RemoveTask(string hash)
        {
        }

        // start the upload server
        public void StartServer()
        {
        }

        // stop the upload server
        public void StopServer()
        {
        }

        // if a thread safe stop has failed we will kill the thread
        public void ForceStopServer()
        {
        }
    }
}
